import 'package:flutter/material.dart';

class DrawLeft extends StatelessWidget {
  final Function changeTabbar;
  const DrawLeft({super.key, required this.changeTabbar});

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Padding(
          padding: const EdgeInsets.only(left: 10, top: 50),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.end,
            children: [
              Image(
                width: 60,
                height: 60,
                image: AssetImage('lib/images/icon.png'),
              ),
              Padding(
                padding: const EdgeInsets.only(left: 10),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text('开发模板',
                        style: TextStyle(
                          fontSize: 20,
                          fontWeight: FontWeight.bold,
                        )),
                    Container(
                      width: 100,
                      padding: const EdgeInsets.only(top: 3, bottom: 2),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.center,
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('Lv.10'),
                          Icon(
                            Icons.whatshot_outlined,
                            size: 18,
                            color: Theme.of(context).colorScheme.primary,
                          )
                        ],
                      ),
                    ),
                    Container(
                      width: 100,
                      height: 5,
                      decoration: BoxDecoration(
                        color: Theme.of(context).colorScheme.primary,
                        borderRadius: BorderRadius.circular(10),
                      ),
                    ),
                  ],
                ),
              )
            ],
          ),
        ),
        Divider(
          color: Colors.grey,
          height: 20,
          thickness: 1,
          indent: 0,
          endIndent: 0,
        ),
        Padding(
          padding: const EdgeInsets.only(left: 10, right: 10),
          child: MenuItemButton(
            leadingIcon: Icon(Icons.cottage),
            child: Text('首页'),
            onPressed: () {
              changeTabbar(0);
              Navigator.of(context).pop();
            },
          ),
        ),
        Padding(
          padding: const EdgeInsets.only(left: 10, right: 10),
          child: MenuItemButton(
            leadingIcon: Icon(Icons.text_snippet),
            child: Text('测试'),
            onPressed: () => {
              changeTabbar(1),
              Navigator.of(context).pop(),
            },
          ),
        ),
        Padding(
          padding: const EdgeInsets.only(left: 10, right: 10),
          child: MenuItemButton(
            leadingIcon: Icon(Icons.settings),
            child: Text('设置'),
            onPressed: () => {
              changeTabbar(2),
              Navigator.of(context).pop(),
            },
          ),
        ),
      ],
    );
  }
}
